package com.ruoyi.consume.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.consume.mapper.RegulatorApplyConMapper;
import com.ruoyi.consume.domain.RegulatorApplyCon;
import com.ruoyi.consume.service.IRegulatorApplyConService;

/**
 * 调节剂领用Service业务层处理
 *
 * @author ruoyi
 * @date 2021-07-23
 */
@Service
public class RegulatorApplyConServiceImpl implements IRegulatorApplyConService
{
    @Autowired
    private RegulatorApplyConMapper regulatorApplyConMapper;

    /**
     * 查询调节剂领用
     *
     * @param regulatorApplyId 调节剂领用ID
     * @return 调节剂领用
     */
    @Override
    public RegulatorApplyCon selectRegulatorApplyById(Long regulatorApplyId)
    {
        return regulatorApplyConMapper.selectRegulatorApplyById(regulatorApplyId);
    }

    /**
     * 查询调节剂领用列表
     *
     * @param regulatorApplyCon 调节剂领用
     * @return 调节剂领用
     */
    @Override
    public List<RegulatorApplyCon> selectRegulatorApplyList(RegulatorApplyCon regulatorApplyCon)
    {
        return regulatorApplyConMapper.selectRegulatorApplyList(regulatorApplyCon);
    }

    /**
     * 新增调节剂领用
     *
     * @param regulatorApplyCon 调节剂领用
     * @return 结果
     */
    @Override
    public int insertRegulatorApply(RegulatorApplyCon regulatorApplyCon)
    {
        regulatorApplyCon.setCreateTime(DateUtils.getNowDate());
        return regulatorApplyConMapper.insertRegulatorApply(regulatorApplyCon);
    }

    /**
     * 修改调节剂领用
     *
     * @param regulatorApplyCon 调节剂领用
     * @return 结果
     */
    @Override
    public int updateRegulatorApply(RegulatorApplyCon regulatorApplyCon)
    {
        regulatorApplyCon.setUpdateTime(DateUtils.getNowDate());
        return regulatorApplyConMapper.updateRegulatorApply(regulatorApplyCon);
    }

    /**
     * 批量删除调节剂领用
     *
     * @param regulatorApplyIds 需要删除的调节剂领用ID
     * @return 结果
     */
    @Override
    public int deleteRegulatorApplyByIds(Long[] regulatorApplyIds)
    {
        return regulatorApplyConMapper.deleteRegulatorApplyByIds(regulatorApplyIds);
    }

    /**
     * 删除调节剂领用信息
     *
     * @param regulatorApplyId 调节剂领用ID
     * @return 结果
     */
    @Override
    public int deleteRegulatorApplyById(Long regulatorApplyId)
    {
        return regulatorApplyConMapper.deleteRegulatorApplyById(regulatorApplyId);
    }

    /**
     * 更新库存量表
     *
     * @param regulatorApplyCon 调节剂领用ID
     * @return 结果
     */
    @Override
    public int updateRegulatorAmount(RegulatorApplyCon regulatorApplyCon){
        return regulatorApplyConMapper.updateRegulatorAmount(regulatorApplyCon);
    }

    /**
     * 更新领用状态
     *
     * @param regulatorApplyId 调节剂领用ID
     * @return 结果
     */
    @Override
    public int updateConsumeStatus(Long regulatorApplyId){
        return regulatorApplyConMapper.updateConsumeStatus(regulatorApplyId);
    }

    /**
     * 退回操作
     *
     * @param regulatorApplyId 调节剂领用ID
     * @return 结果
     */
    @Override
    public int updateApprovalStatus(Long regulatorApplyId){
        return regulatorApplyConMapper.updateApprovalStatus(regulatorApplyId);
    }
}
